#include "iconprovider.h"

#include "picturemanager.h"
#include "utils.h"

#include <QStyle>

IconProvider::IconProvider(PictureManager *manager) :
        manager(manager)
{
}

QIcon IconProvider::icon ( QFileIconProvider::IconType type) const {


    if(type == QFileIconProvider::Folder) {
        QSize iconSize(36, 36);
        return  QIcon(this->manager->getStyl()->standardIcon(QStyle::SP_DirIcon).pixmap(iconSize));
    }

    return QIcon();

}


QIcon IconProvider::icon ( const QFileInfo & info ) const
{
        QPixmap pixmap = QPixmap::fromImage(Utils::generateIcon(info));

        if ( !pixmap.isNull() )
        {

            return QIcon( pixmap );
        }

    return QIcon();
}


